import 'package:enterprise_v6_app/generated/json/base/json_convert_content.dart';
import 'package:enterprise_v6_app/app/data/entities/auth/company_api_config_entity.dart';

CompanyApiConfigEntity $CompanyApiConfigEntityFromJson(Map<String, dynamic> json) {
  final CompanyApiConfigEntity companyApiConfigEntity = CompanyApiConfigEntity();
  final String? id = jsonConvert.convert<String>(json['id']);
  if (id != null) {
    companyApiConfigEntity.id = id;
  }
  final List<String>? tileAddress = (json['tileAddress'] as List<dynamic>?)?.map(
          (e) => jsonConvert.convert<String>(e) as String).toList();
  if (tileAddress != null) {
    companyApiConfigEntity.tileAddress = tileAddress;
  }
  final List<String>? terrainAddress = (json['terrainAddress'] as List<dynamic>?)?.map(
          (e) => jsonConvert.convert<String>(e) as String).toList();
  if (terrainAddress != null) {
    companyApiConfigEntity.terrainAddress = terrainAddress;
  }
  final List<String>? faceUrl = (json['faceUrl'] as List<dynamic>?)?.map(
          (e) => jsonConvert.convert<String>(e) as String).toList();
  if (faceUrl != null) {
    companyApiConfigEntity.faceUrl = faceUrl;
  }
  final String? companyCode = jsonConvert.convert<String>(json['companyCode']);
  if (companyCode != null) {
    companyApiConfigEntity.companyCode = companyCode;
  }
  final String? createDate = jsonConvert.convert<String>(json['createDate']);
  if (createDate != null) {
    companyApiConfigEntity.createDate = createDate;
  }
  final String? updateDate = jsonConvert.convert<String>(json['updateDate']);
  if (updateDate != null) {
    companyApiConfigEntity.updateDate = updateDate;
  }
  return companyApiConfigEntity;
}

Map<String, dynamic> $CompanyApiConfigEntityToJson(CompanyApiConfigEntity entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['id'] = entity.id;
  data['tileAddress'] = entity.tileAddress;
  data['terrainAddress'] = entity.terrainAddress;
  data['faceUrl'] = entity.faceUrl;
  data['companyCode'] = entity.companyCode;
  data['createDate'] = entity.createDate;
  data['updateDate'] = entity.updateDate;
  return data;
}

extension CompanyApiConfigEntityExtension on CompanyApiConfigEntity {
  CompanyApiConfigEntity copyWith({
    String? id,
    List<String>? tileAddress,
    List<String>? terrainAddress,
    List<String>? faceUrl,
    String? companyCode,
    String? createDate,
    String? updateDate,
  }) {
    return CompanyApiConfigEntity()
      ..id = id ?? this.id
      ..tileAddress = tileAddress ?? this.tileAddress
      ..terrainAddress = terrainAddress ?? this.terrainAddress
      ..faceUrl = faceUrl ?? this.faceUrl
      ..companyCode = companyCode ?? this.companyCode
      ..createDate = createDate ?? this.createDate
      ..updateDate = updateDate ?? this.updateDate;
  }
}
